home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
try_qb
/
mandel.bas
(
.txt
)
< prev
next >
Wrap
QuickBASIC Tokenized Source
|
1989-12-04
|
5KB
|
98 lines
ShiftPalette
WindowVals
ScreenTest
FALSE
TRUEi
MAXLOOP
MAXSIZE
PaletteArray5
WLeft
WRight
WBottom
EgaMode
ColorRange
VLeft
VRight
VBottom
XLength
YLength
ColorWidth
LogicY
OldColor
LogicX
MandelX
MandelY
RealNum
ImagNum
PColor
BadScreen
Default variable type is integer
Boolean constants
Set maximum number of iterations per point:
Call WindowVals to get coordinates of window corners:
Call ScreenTest to find out if this is an EGA machine,
and get coordinates of viewport corners:n
Define viewport and corresponding window:
Press any key to quit.
Loop through each pixel in viewport and calculate
whether or not it is in the Mandelbrot Set:
Loop through every line in:
the viewport.
Get the pixel's logical y
coordinate.
Plot leftmost pixel in the line.
Start with background color.
Loop through every pixel in
the line.
Get the pixel's logical x
coordinate .t
Do the calculations to see if this point is in
the Mandelbrot Set:
Assign a color to the point:
If color has changed, draw a line from the
last point referenced to the new point,
using the old color:d
Draw the last line segment to the right edge of
the viewport:
If this is an EGA machine, shift the palette after
drawing each line:m
Continue shifting the palette until the user
presses a key:i
Restore the screen to text mode,
80 columns.
Error handler that is invoked if
there is no EGA graphics card
ShiftPalette
= ShiftPalette
Rotates the palette by one each time it is called.
WindowVals
= WindowVals
Gets window corners as input from the user, or sets
values for the corners if there is no input.o
This program prints the graphic representation of"
the complete Mandelbrot Set. The default window is
from (-1000,625) to (250,-625). To zoom in on part
of the figure, input coordinates inside this window.
Press <ENTER> to see the default window. Press any
other key to input your own window coordinates:
User didn't press ENTER, so input window corners:
X coordinate of upper left corner: "
X coordinate of lower right corner:
Right corner must be greater than left corner.
Y coordinate of upper left corner: "
Y coordinate of lower right corner:
Bottom corner must be less than top corner."
Pressed ENTER, so set default values.
ScreenTest
= ScreenTest
Tests to see if user has EGA hardware with SCREEN 8.=
If this causes an error, the EM flag is set to FALSE,
and the screen is set with SCREEN 1.
Also sets values for corners of viewport (VL = left,,
VR = right, VT = top, VB = bottom), scaled with the
correct aspect ratio so viewport is a perfect square.
No error, so SCREEN 8 is OK
16 colors (0 - 15)N
Error, so use SCREEN 1N
4 colors (0 - 3)E